﻿function loadindexchart() {
    var title = "FIOC年度产量对比图(单位:吨)";
    var xml = "<graph caption='"+title+"'  showValues='0' showExportDataMenuItem='1' baseFontSize='9'  showYAxisValues='1'   placevaluesinside='1'>";
    var rows = $("#chanliang tr").length; //表格行数
    var cols = $("#chanliang tr:eq(0) th").length; //表格列数
    //alert(cols);
    xml += "<categories>      <category label='1月' />      <category label='2月' />      <category label='3月' />      <category label='4月' />      <category label='5月' />      <category label='6月' />      <category label='7月' />      <category label='8月' />      <category label='9月' />      <category label='10月' />      <category label='11月' />      <category label='12月' />   </categories>";
    for (var i = 1; i < cols; i++) {
        var caption = $("#chanliang tr:eq(0) th").eq(i).text(); //表头
        
        xml += "<dataset seriesName='" + caption + "'>";
        for (var j = 1; j < rows; j++) {
            var val = $("#chanliang tr:eq(" + j + ") td").eq(i).text(); //数值
            xml += " <set value='"+val+"' />";
        }
        xml += "</dataset>";
    }
    xml += "</graph>";
    //alert(xml);
    chart(xml, "../../FCF/MSLine.swf", 590, 320, "chartContainer2");
    hidegrid();
}


function loadindexchart2() {
    var title = "钻井日进尺变化曲线(单位：m)";
    var xml = "<graph caption='" + title + "' showValues='1' showExportDataMenuItem='1' baseFontSize='9'  showYAxisValues='1'  labelDisplay='NOWRAP' placevaluesinside='2' labelStep='4' yAxisMaxValue='3200'>";
    var rows = $("#gv tr").length; //表格行数

    var cols = $("#gv tr:eq(0) th").length; //表格列数
    //alert(cols);
    for (var i = 1; i < rows - 1; i++) {
        var caption = $("#gv tr:eq(" + i + ") td").eq(1).text(); //第2列为年月日
        var val = $("#gv tr:eq(" + i + ") td").eq(2).text(); //第3列为数值
        xml += "<set name='" + caption + "' value='" + val + "' link='n-Modules/ZuanjingRb/Zjrblr.aspx?rq=" + caption + "'/>";
    }
    xml += "</graph>";
    //alert(xml);

    chart(xml, "../../FCF/line.swf", 590, 320, "chartContainer2");
    hidegrid();
}

function hidegrid() {
    $("#gv").hide();
    $("#chanliang").hide();
}

function chart(xml, swf, width, height, chartdiv) {
    var chartObj = new FusionCharts(swf, "chartId", width, height, "0", "1");
    chartObj.setDataXML(xml);
    //alert(xml);
    chartObj.configure("ChartNoDataText", "no data to display");
    chartObj.render(chartdiv);
}